Home assistant networking on Arch Linux

I'm running Home Assistant on a Thinkpad T420 that I had laying around, which happened to run Arch Linux. Not the easiest setup, because I wasn't familiar on how to run and manage Virtual Machines on Arch.

After setting it up, I completely forgot how to.

Networking

On the networking side of things, I had to create a bridge network to ensure that Home Assistant appears as a normal device on the local network while running from a VM. I mostly forgot how I did that as well (I set it up after a major surgery while being on decent pain killers...)

Here are some bits and pieces:

/etc/systemd/network/hass_bridge.network:

[Match]
Name=hass_bridge

[Network]
Address=192.168.178.9/24
Gateway=192.168.178.1
DNS=192.168.178.1

The laptop host has static ip 192.168.178.9/24 which is assigned here to the bridge network.

Defining the bridge network in /etc/systemd/network/hass_bridge.netdev:

[NetDev]
Name=hass_bridge
Kind=bridge

The following config /etc/systemd/network/enp0s25.network attaches the Thinkpad's physical network interface to the bridge (I'm running the laptop on ethernet cable).

[Match]
Name=enp0s25

[Network]
Bridge=hass_bridge

ip link should show hass_bridge

I occasionally experience issues where I cannot reach HA anymore. I haven't spent time figuring out why, but these are the steps I typically do to restore service.

sudo systemctl restart systemd-networkd

I apparently have run sudo dhcpcd in the past, but this may be a problem actually because maybe I'm managing the network with different network managers?

Home assistant runs on http://192.168.178.100:8123/ in the VM. In my VM manager I have configured the usage of the bridge network (forgot the specifics).

To do on next failure

Then verify:

ip addr show hass_bridge
ip addr show enp0s25
ip route
bridge link
networkctl status hass_bridge
networkctl status enp0s25

You would expect:

hass_bridge to have 192.168.178.9/24
enp0s25 not to have its own IPv4 address
the default route to use 192.168.178.1
enp0s25 to appear as a port of hass_bridge